import request from '@/utils/request'


// export function login(data) {
//   return request({
//     url: '/vue-admin-template/user/login',
//     method: 'post',
//     data
//   })
// }

export function login(data) {
  return request({
    url: 'http://localhost:7788/admin/login',
    method: 'post',
    data
  })
}

// export function getInfo(token) {
//   return request({
//     url: '/vue-admin-template/user/info',
//     method: 'get',
//     params: { token }
//   })
// }


export function getInfo(token) {
  return request({
    url: 'http://localhost:7788/admin/getInfo',
    method: 'get',
    params: { token }
  })
}

// export function logout() {
//   return request({
//     url: '/vue-admin-template/user/logout',
//     method: 'post'
//   })
// }

export function logout(token) {
  return request({
    url: 'http://localhost:7788/admin/logout',
    method: 'get',
    params: { token }
  })
}


export function getList(params) {
  return request({
    url: 'http://localhost:7788/user/list',
    method: 'get',
    params
  })
}


export default {

  // login(data) {
  //   return request({
  //     url: 'http://localhost:7788/admin/login',
  //     method: 'post',
  //     data
  //   })
  // },
  getList(params) {
    return request({
      url: 'http://localhost:7788/user/list',
      method: 'get',
      params
    })
  },

  changeStatus(status,id){
    return request({
      url: `http://localhost:7788/user/status?status=${status}&id=${id}`,
      method: 'get', 
    });
  },

  getUserById(id){
    return request({
      url: `http://localhost:7788/user/${id}`,
      method: 'get', 
    });
  },
  editUser(user){
    return request({
      url: `http://localhost:7788/user/edit`,
      method: 'post', 
      data:user
    });
  },
  addUser(user){
    return request({
      url: `http://localhost:7788/user/add`,
      method: 'post', 
      data:user
    });
  },

  deleteUser(id){
    return request({
      url: `http://localhost:7788/user/delete/${id}`,
      method: 'get', 
    });
  },

}


